/*public class OutClass {
    //成员位置定义：未被static修饰 -》 实例内部类
    public class InnerClass {

    }
    //成员位置定义：被static修饰 -》 静态内部类
    static class Work {

    }

    //也可以在方法中定义类 -》 局部内部类 -> 几乎不使用
    public void func() {
        class func2 {

        }
    }
}*/

public class OutClass {
    public int a = 10;
    public String b = "#######";
    public static int c = 20;
    public String ch = "外部类优先";

    public void printOut() {
        System.out.println("I Love China!!!");
    }
    /*
    * 实例内部类
    * 1. 如何获取实例内部类的对象？
    */
    class InnerClass {//内部类
        public int day = 12;
        public String tele = "193 8979 0399";
        public  static final int age = 19;
        public String ch = "实例内部类优先";

        public void printIn() {
            /*System.out.println("I Love Java!!!");
            System.out.println(a);
            System.out.println(b);
            System.out.println(c);
            System.out.println(day);
            System.out.println(tele);
            System.out.println(age);*/
            OutClass outClass = new OutClass();
            System.out.println(OutClass.this.ch);//引用外部类成员
            System.out.println(ch);
        }
    }

    public static void main(String[] args) {
        OutClass outClass = new OutClass();
        OutClass.InnerClass innerClass = outClass.new InnerClass();
        innerClass.printIn();
    }

    public static void main1(String[] args) {
        OutClass outClass = new OutClass();
        OutClass.InnerClass innerClass = outClass.new InnerClass();
        System.out.println("外部类ch：" + outClass.b);
        System.out.println("外部类a：" + outClass.a);
        System.out.println("内部类tele：" + innerClass.tele);
        System.out.println("内部类age：" + innerClass.age);
    }
}